package test;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author xukai
 * @desc
 * @date 2016-12-30-下午 2:16
 */
@Component
public class AsyncHelp {



    @Async("asyncExecutor")
    public void testAsync(int i){
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName() + "=======:" + (i+1));
    }

    @Scheduled(fixedDelay=5000)
    public void sout(){
        System.out.println(Thread.currentThread().getName() + "=======:" +1);
    }
}
